package com.xjgzinfo.usdp.service.dto;

import com.xjgzinfo.usdp.jpa.service.Criteria;
import com.xjgzinfo.usdp.jpa.service.filter.Filter;
import com.xjgzinfo.usdp.jpa.service.filter.IntegerFilter;
import com.xjgzinfo.usdp.jpa.service.filter.LongFilter;
import com.xjgzinfo.usdp.jpa.service.filter.StringFilter;

import java.io.Serializable;
import java.util.Objects;

/**
 * Criteria class for the {@link com.xjgzinfo.usdp.domain.BladeVisualGlobal} entity. This class is used
 * in {@link com.xjgzinfo.usdp.web.rest.BladeVisualGlobalResource} to receive all the possible filtering options from
 * the Http GET request parameters.
 * For example the following could be a valid request:
 * {@code /blade-visual-categories?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
 * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
 * fix type specific filters.
 */
public class BladeVisualGlobalCriteria implements Serializable, Criteria {

    private static final long serialVersionUID = 1L;

    private LongFilter id;

    private StringFilter globalName;

    private StringFilter globalKey;

    private StringFilter globalValue;

    private IntegerFilter isDeleted;

    public BladeVisualGlobalCriteria() {
    }

    public BladeVisualGlobalCriteria(BladeVisualGlobalCriteria other) {
        this.id = other.id == null ? null : other.id.copy();
        this.globalName = other.globalName == null ? null : other.globalName.copy();
        this.globalKey = other.globalKey == null ? null : other.globalKey.copy();
        this.globalValue = other.globalValue == null ? null : other.globalValue.copy();
        this.isDeleted = other.isDeleted == null ? null : other.isDeleted.copy();
    }

    @Override
    public BladeVisualGlobalCriteria copy() {
        return new BladeVisualGlobalCriteria(this);
    }

    public LongFilter getId() {
        return id;
    }

    public void setId(LongFilter id) {
        this.id = id;
    }

    public StringFilter getGlobalName() {
        return globalName;
    }

    public void setGlobalName(StringFilter globalName) {
        this.globalName = globalName;
    }


    public StringFilter getGlobalKey() {
        return globalKey;
    }

    public void setGlobalKey(StringFilter globalKey) {
        this.globalKey = globalKey;
    }

    public StringFilter getGlobalValue() {
        return globalValue;
    }

    public void setGlobalValue(StringFilter globalValue) {
        this.globalValue = globalValue;
    }

    public IntegerFilter getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(IntegerFilter isDeleted) {
        this.isDeleted = isDeleted;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final BladeVisualGlobalCriteria that = (BladeVisualGlobalCriteria) o;
        return
                Objects.equals(id, that.id) &&
                        Objects.equals(globalName, that.globalName) &&
                        Objects.equals(globalKey, that.globalKey) &&
                        Objects.equals(globalValue, that.globalValue) &&
                        Objects.equals(isDeleted, that.isDeleted);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                id,
                globalName,
                globalKey,
                globalValue,
                isDeleted
        );
    }


    @Override
    public String toString() {
        return "BladeVisualGlobalCriteria{" +
                "id=" + id +
                ", globalName=" + globalName +
                ", globalKey=" + globalKey +
                ", globalValue=" + globalValue +
                ", isDeleted=" + isDeleted +
                '}';
    }
}
